package com.texplose.controller;

import com.texplose.entity.vo.ResponseResult;
import com.texplose.entity.vo.SendCommentVo;
import com.texplose.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author : lyj
 * @Timer : 2022/5/31
 * @Description :
 */
@RestController
@RequestMapping("/comment")
public class CommentController {
    @Autowired
    private CommentService commentService;

    @GetMapping("/count/{recipeId}")
    public ResponseResult count(@PathVariable("recipeId") Integer recipeId){
        return commentService.count(recipeId);
    }

    @GetMapping("/commentList/{recipeId}")
    public ResponseResult listComment(@PathVariable("recipeId") Integer recipeId){
        return commentService.listComment(recipeId);
    }

    @PostMapping("/sendComment")
    public ResponseResult sendComment(@RequestBody SendCommentVo comment){
        return commentService.insertComment(comment);
    }



}
